﻿//*************************************************************************
//面向服务的协作式智能交通系统仿真软件SoC-ITSS v2.1 alpha
//发布单位：西北工业大学--巴黎高科MINES机器人与群智能系统联合实验室
//团队负责人：张凯龙 Zhang Kailong
//团队成员：张大方、杨安胜、王敏、谢策、王雨佳、谢尘玉等
//联系我们：kl.zhang@nwpu.edu.cn
//2012-2021
//*************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

//*******************************************************
//
//文件名(File Name):           Message.cs
//
//数据表(Tables):              nothing 
//
//          修改理由：         增加属性、方法
//
//*******************************************************

namespace CyberCarSimulation.Bean
{
    class Message
    {
        private String Sender;      //信息发送方
        private String Receiver;    //信息接收方 id
        private int Type;           //信息类型，由消息的类别标识
        private float[] Ts;         //临界区的到达时间，若为AtoV消息，则此到达时间为-1
        private float[] Te;         //临界区的离开时间，若为AtoV消息，则此到达时间为-1
        private int Priority;       //车辆的优先级
        private String SectionID;   //车辆的临界区
        private int LaneID;         //车辆所处的车道
        private string LaneIDStr;   //车辆所处的车道ID
        private float Total_Dis;    //车辆的位置信息


        //构造函数
        public Message(int Type, String Sender, String Receiver, float[] Ts, float[] Te, float Total_Dis,
                                   int Priority, String SectionID, int LaneID, string LaneIDStr)
        {
            this.Type = Type;
            this.Sender = Sender;
            this.Receiver = Receiver;
            this.Ts = Ts;
            this.Te = Te;
            this.Priority = Priority;
            this.SectionID = SectionID;
            this.LaneID = LaneID;
            this.Total_Dis = Total_Dis;
            this.LaneIDStr = LaneIDStr;
        }

        public int GetType()
        {
            return this.Type;
        }

        public String GetSender()
        {
            return this.Sender;
        }

        public String GetReceiver()
        {
            return this.Receiver;
        }

        public float GetTs(int i)
        {
            return this.Ts[i];
        }

        public float[] GetTsArray()
        {
            return this.Ts;
        }

        public float GetTe(int i)
        {
            return this.Te[i];
        }

        public float[] GetTeArray()
        {
            return this.Te;
        }

        public float GetPTW(int i)
        {
            return (this.Te[i] - this.Ts[i]);
        }

        public float[] GetPTWArray()
        {
            float[] ptw = new float[5];
            for (int i = 0; i < 5; i++)
            {
                ptw[i] = this.Te[i] - this.Ts[i];
            }
            return ptw;
        }

        public int GetPriority()
        {
            return this.Priority;
        }

        public String GetSectionID()
        {
            return this.SectionID;
        }

        public int GetsectionIDCount()
        {
            return this.SectionID.Length;
        }

        public int GetLaneID()
        {
            return this.LaneID;
        }

        public float GetTotal_Dis()
        {
            return this.Total_Dis;
        }

        public string GetLaneIDStr() 
        {
            return this.LaneIDStr;
        }

        public void SetLaneIDStr(string LaneIDStr) 
        {
            this.LaneIDStr = LaneIDStr;
        }

        //public bool MessageEquals(Message m) 
        //{
        //    bool flag = false;
        //    if(this.GetLaneID)
        //}
    }
}
